//
//  UserDefaultsUtilsTest.swift
//  SwiftUtils
//
//  Created by Ink on 2022/1/26.
//

import Foundation

class UserDefaultsConfig: NSObject {
    
    static let mClassName = UserDefaultsConfig.className
    
    static var share = UserDefaultsConfig()
    
    @UserDefault(nil, mClassName + "." + "isTest")
    var isTest: Bool = true
    
    @UserDefaultAstrictComparable(nil, mClassName + "." + "testCount" , 5...10)
    var testCount: Int = 0
}


class UserDefaultsTest {
    
    let congig = UserDefaultsConfig.share
    
    func execute() {
        
        print("congig.isTest:\(congig.isTest)")
        congig.isTest = true
        print("congig.isTest:\(congig.isTest)")
        congig.isTest = false
        print("congig.isTest:\(congig.isTest)")
        print("")
        
        print("congig.testCount:\(congig.testCount)")
        for i in 0...15 {
            congig.testCount = i
            print("i:\(i)")
            print("congig.testCount:\(congig.testCount)")
            print("")
        }
    }
}
